package com.wao.product.service.mapper;

import com.wao.product.domain.*;
import com.wao.product.service.dto.ValueDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity Value and its DTO ValueDTO.
 */
@Mapper(componentModel = "spring", uses = {PropertyMapper.class, })
public interface ValueMapper extends EntityMapper <ValueDTO, Value> {

    @Mapping(source = "property.id", target = "propertyId")
    @Mapping(source = "property.name", target = "propertyName")
    ValueDTO toDto(Value value); 

    @Mapping(source = "propertyId", target = "property")
    Value toEntity(ValueDTO valueDTO); 
    default Value fromId(Long id) {
        if (id == null) {
            return null;
        }
        Value value = new Value();
        value.setId(id);
        return value;
    }
}
